#include "SList.h"

void test1() {
	SLTNode* plist = NULL;

	SLTPushBack(&plist, 1);
	SLTPushBack(&plist, 2);
	SLTPushBack(&plist, 3);
	SLTPushBack(&plist, 4);
	SLTPrint(plist);
	SLTPopBack(&plist);
	SLTPrint(plist);
	SLTPopBack(&plist);
	SLTPrint(plist);
	SLTPopBack(&plist);
	SLTPrint(plist);
	SLTPopBack(&plist);
	SLTPrint(plist);

	
}

void test2() {
	SLTNode* plist = NULL;
	SLTPushFront(&plist, 1);
	SLTPushFront(&plist, 2);
	SLTPushFront(&plist, 3);
	SLTPushFront(&plist, 4);
	SLTPushFront(&plist, 5);
	SLTPrint(plist);
	SLTPopBack(&plist);
	SLTPrint(plist);
	SLTPopFront(&plist);
	SLTPrint(plist);
	SLTPushBack(&plist, 30);
	SLTPrint(plist);
	SLTPushBack(&plist, 40);
	SLTPrint(plist);

	SLTNode* pos1 = SListFind(plist, 4);
	SLTInsert(&plist, pos1, 5);
	SLTPrint(plist);

	SLTNode* pos2 = SListFind(plist, 5);
	SLTErase(&plist, pos2);
	SLTPrint(plist);

	SLTInsertAfter(&plist, pos1, 6);
	SLTPrint(plist);

	SLTNode* pos3 = SListFind(plist, 40);
	SLTInsertAfter(&plist, pos3, 50);
	SLTPrint(plist);

	SLTEraseAfter(&plist, pos3);
	SLTPrint(plist);
	SLTNode* pos4 = SListFind(plist, 2);
	SLTEraseAfter(&plist, pos4);
	SLTPrint(plist);

	SLTDestroy(plist);
}

int main() {
	test2();
	return 0;
}

